<style src="../../style/statistics.css" scoped></style>
<template>
    <div>
        <Row>
            <!--搜索框-->
                <Col span="14" class="col-margin">
                    <label  v-show="userInfo.AreaCode=='530000000000'">所属地区:</label>
                    <Select v-model="searchModel.AreaCode" placeholder="全部" :label-in-value="true" @on-change="SearchCascaderChange" style="width:120px" v-show="userInfo.AreaCode=='530000000000'">
                        <Option :value="item.value" v-for="item in AreaList" :key="item.value">{{item.label}}</Option>
                    </Select>                  -->
                    填报年度:
                    <Select v-model="searchModel.FillInYear" placeholder="全部" :label-in-value="true" @on-change="GetData()" style="width:120px">
                        <Option :value="item.DictValue" v-for="item in CreateYearList" :key="item.DictValue">{{item.DictText}}</Option>
                    </Select>
                    填报周期：
                    <Select  v-model="searchModel.TimesCycle" placeholder="请选择季别" style="width:100px;" @on-change="GetData()">
                        <Option :value="item.DictValue" v-for="item in QuarterList" :key="item.DictValue">{{item.DictText}}</Option>
                    </Select>
                    <Select  v-model="searchModel.SeasonDict" placeholder="请选择季节值..." style="width:140px;" @on-change="GetData()" v-show="searchModel.TimesCycle==3">
                        <Option value="" >全部</Option>
                        <Option value="小春作" >小春作</Option>
                        <Option value="早春作" >早春作</Option>
                        <Option value="冬作" >冬作</Option>
                    </Select>
                    <Button  type="primary" v-show="listShow" @click="Download()">导出列表</Button> 
                </Col>                      
                <Col span="10" class="col-margin" style="text-align:right;">  
                <RadioGroup v-model="currentButton" @on-change="changeButton" type="button"  size="large">
                        <Radio label="listShow" title="列表"><Icon type="ios-paper" size="35"></Icon></Radio>                            
                        <Radio label="pieShow" title="饼图"><Icon type="ios-pie" size="35"></Icon></Radio>
                        <Radio label="mapShow" title="地图"><Icon type="android-map" size="35"></Icon></Radio>                            
                    </RadioGroup>                    
              </Col>                              
        </Row>
        <Row  v-show="listShow">
            <!-- 列表-->
            <div class="col-margin" >
                <Table  :columns="columnList" no-data-text="暂无数据....." :data="dataList" border :height="clientHeight"></Table>
                <!-- <div style="overflow-x:auto;margin-top:40px">
                <Tabs  :animated="false" v-show="!isCounty">
                    <TabPane label="总体概况">
                        <table class="statisTable" :style="tableStyle" >
                            <thead>
                                <tr>                            
                                    <th rowspan="3">季别</th>
                                    <th rowspan="3">总面积（万亩）</th>
                                    <th rowspan="3">总产量（万吨）</th>
                                    <th rowspan="3">总产值（万元）</th>
                                    <th rowspan="3">平均亩产（公斤/亩）</th>
                                    <th rowspan="3">亩产值（元）</th>
                                    <th rowspan="3">脱毒种薯覆盖率%</th>
                                    <th rowspan="3">地膜覆盖面积（万亩）</th>
                                    <th rowspan="3">膜下滴灌面积（万亩）</th>
                                    <th rowspan="3">配方施肥面积（万亩）</th>
                                    <th rowspan="3">免耕栽培面积（万亩）</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for="(dataModel,index) in dataList" :key="index">
                                    <td style="text-align:center">
                                        {{dataModel.SeasonDict}}
                                    </td>
                                    <td>
                                        {{dataModel.TotalArea}}
                                    </td>  
                                    <td>
                                        {{dataModel.TotalYield}}
                                    </td>
                                    <td>
                                        {{dataModel.TotalOutput}}
                                    </td>
                                    <td>
                                        {{dataModel.AvgMuYield}}
                                    </td>
                                    <td>
                                        {{dataModel.MuOutput}}
                                    </td> 
                                    <td>
                                        {{dataModel.SeedCoverage}}
                                    </td>
                                    <td>
                                        {{dataModel.MulchArea}}
                                    </td>
                                    <td>
                                        {{dataModel.DripArea}}
                                    </td> 
                                    <td>
                                        {{dataModel.FertilizerArea}}
                                    </td>
                                    <td>
                                        {{dataModel.NoCultivationArea}}
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </TabPane>
                    <TabPane label="净作" >
                        <table class="statisTable" :style="tableStyle">
                            <thead>
                                <tr>
                                    <th rowspan="2">季别</th>
                                    <th colspan="6">净作</th>
                                </tr>
                                <tr>
                                    <th rowspan="2">面积（万亩）</th>
                                    <th rowspan="2">产量（万吨）</th>
                                    <th rowspan="2">平均亩产（公斤/亩）</th>
                                    <th rowspan="2">产值（万元）</th>
                                    <th rowspan="2">亩产值（元）</th>
                                    <th rowspan="2">种植密度（株/亩）</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for="(dataModel,index) in dataList" :key="index">
                                    <td style="text-align:center">
                                        {{dataModel.SeasonDict}}
                                    </td>
                                    <td>
                                        {{dataModel.JZArea}}
                                    </td>   
                                    <td>
                                        {{dataModel.JZYield}}
                                    </td>
                                    <td>
                                        {{dataModel.JZAvgYield}}
                                    </td>
                                    <td>
                                        {{dataModel.JZOutput}}
                                    </td>
                                    <td>
                                        {{dataModel.JZMuOutput}}
                                    </td>
                                    <td>
                                        {{dataModel.JZDensity}}
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </TabPane>
                    <TabPane label="间作、套种" >
                        <table class="statisTable" :style="tableStyle" >
                            <thead>
                                <tr> 
                                    <th rowspan="2">季别</th>
                                    <th colspan="7">间作、套种</th>
                                </tr>
                                <tr>
                                    <th rowspan="2">面积（万亩）</th>
                                    <th rowspan="2">马铃薯产量（万吨）</th>
                                    <th rowspan="2">马铃薯平均亩产（公斤/亩）</th>
                                    <th rowspan="2">复合产量（万吨）</th>
                                    <th rowspan="2">复合产值（万元）</th>
                                    <th rowspan="2">复合亩产（公斤/亩）</th>
                                    <th rowspan="2">复合亩产值（元）</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for="(dataModel,index) in dataList" :key="index">
                                    <td style="text-align:center">
                                        {{dataModel.SeasonDict}}
                                    </td>
                                    <td>
                                        {{dataModel.JTArea}}
                                    </td>  
                                    <td>
                                        {{dataModel.JTYield}}
                                    </td> 
                                    <td>
                                        {{dataModel.JTAvgYield}}
                                    </td> 
                                    <td>
                                        {{dataModel.JTMixYield}}
                                    </td>
                                    <td>
                                        {{dataModel.JTMixOutput}}
                                    </td>
                                    <td>
                                        {{dataModel.JTMixMuYield}}
                                    </td>
                                    <td>
                                        {{dataModel.JTMixMuOutput}}
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </TabPane>
                    <TabPane label="机械化生产" >
                        <table class="statisTable" :style="tableStyle" >
                            <thead>
                                <tr> 
                                    <th rowspan="3">季别</th>
                                    <th colspan="5">机械化生产</th>
                                </tr>
                                <tr>
                                    <th rowspan="2">机械播种面积（万亩）</th>
                                    <th colspan="3">机械田间管理面积（万亩）</th>
                                    <th rowspan="2">机械收获面积（万亩）</th>
                                </tr>
                                <tr>
                                    <th>其中：中耕培土</th>
                                    <th>施肥</th>
                                    <th>施药</th>            
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for="(dataModel,index) in dataList" :key="index">
                                    <td style="text-align:center">
                                        {{dataModel.SeasonDict}}
                                    </td>
                                    <td>
                                        {{dataModel.MechPlantArea}}
                                    </td>
                                    <td>
                                        {{dataModel.MechCultivationArea}}
                                    </td>
                                    <td>
                                        {{dataModel.MechFertilizerArea}}
                                    </td>
                                    <td>
                                        {{dataModel.MechPesticideArea}}
                                    </td> 
                                    <td>
                                        {{dataModel.MechHarvestArea}}
                                    </td> 
                                </tr>
                            </tbody>
                        </table>
                    </TabPane>
                    <TabPane label="亩均收益" >
                        <table class="statisTable" :style="tableStyle" >
                            <thead>
                                <tr>  
                                    <th rowspan="3">季别</th>
                                    <th colspan="11">亩均收益</th>
                                </tr>
                                <tr>
                                    <th colspan="7">投入（元）</th>
                                    <th colspan="3">产出</th>
                                    <th rowspan="2">收益</th>
                                </tr>
                                <tr>
                                    <th>种薯</th>
                                    <th>肥料</th>
                                    <th>农药</th>
                                    <th>地膜</th>
                                    <th>全生育期用工费</th>
                                    <th>其他</th>
                                    <th>投入合计</th>   
                                    <th>平均亩产（公斤/亩）</th>
                                    <th>平均单价（元/公斤）</th>
                                    <th>产出合计（元）</th>                      
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for="(dataModel,index) in dataList" :key="index">
                                    <td style="text-align:center">
                                        {{dataModel.SeasonDict}}
                                    </td>
                                    <td>
                                        {{dataModel.SeedCost}}
                                    </td> 
                                    <td>
                                        {{dataModel.FertilizerCost}}
                                    </td> 
                                    <td>
                                        {{dataModel.PesticideCost}}
                                    </td>
                                    <td>
                                        {{dataModel.MulchCost}}
                                    </td>
                                    <td>
                                        {{dataModel.LaborCost}}
                                    </td>
                                    <td>
                                        {{dataModel.OtherCost}}
                                    </td>
                                    <td>
                                        {{dataModel.TotalCost}}
                                    </td>
                                    <td>
                                        {{dataModel.OAvgMuYield}}
                                    </td> 
                                    <td>
                                        {{dataModel.OAvgPrice}}
                                    </td>
                                    <td>
                                        {{dataModel.OTotalOutput}}
                                    </td>
                                    <td>
                                        {{dataModel.Income}}
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </TabPane>
                </Tabs>
                
                <Tabs  :animated="false" v-show="isCounty">
                    <TabPane label="总体概况">
                        <table class="statisTable" :style="tableStyle" >
                            <thead>
                                <tr>                            
                                    <th rowspan="3">季节</th>
                                    <th rowspan="3">总面积（万亩）</th>
                                    <th rowspan="3">总产量（万吨）</th>
                                    <th rowspan="3">总产值（万元）</th>
                                    <th rowspan="3">平均亩产（公斤/亩）</th>
                                    <th rowspan="3">亩产值（元）</th>
                                    <th rowspan="3">脱毒种薯覆盖率%</th>
                                    <th rowspan="3">地膜覆盖面积（万亩）</th>
                                    <th rowspan="3">膜下滴灌面积（万亩）</th>
                                    <th rowspan="3">配方施肥面积（万亩）</th>
                                    <th rowspan="3">免耕栽培面积（万亩）</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for="(dataModel,index) in cdataList" :key="index">
                                    <td style="text-align:center">
                                        {{dataModel.SeasonDict}}
                                    </td>
                                    <td>
                                        {{dataModel.TotalArea}}
                                    </td>  
                                    <td>
                                        {{dataModel.TotalYield}}
                                    </td>
                                    <td>
                                        {{dataModel.TotalOutput}}
                                    </td>
                                    <td>
                                        {{dataModel.AvgMuYield}}
                                    </td>
                                    <td>
                                        {{dataModel.MuOutput}}
                                    </td> 
                                    <td>
                                        {{dataModel.SeedCoverage}}
                                    </td>
                                    <td>
                                        {{dataModel.MulchArea}}
                                    </td>
                                    <td>
                                        {{dataModel.DripArea}}
                                    </td> 
                                    <td>
                                        {{dataModel.FertilizerArea}}
                                    </td>
                                    <td>
                                        {{dataModel.NoCultivationArea}}
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </TabPane>
                    <TabPane label="净作" >
                        <table class="statisTable" :style="tableStyle" >
                            <thead>
                                <tr>
                                    <th colspan="6">净作</th>
                                </tr>
                                <tr>
                                    <th rowspan="2">面积（万亩）</th>
                                    <th rowspan="2">产量（万吨）</th>
                                    <th rowspan="2">平均亩产（公斤/亩）</th>
                                    <th rowspan="2">产值（万元）</th>
                                    <th rowspan="2">亩产值（元）</th>
                                    <th rowspan="2">种植密度（株/亩）</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for="(dataModel,index) in dataList" :key="index">
                                    <td>
                                        {{dataModel.JZArea}}
                                    </td>   
                                    <td>
                                        {{dataModel.JZYield}}
                                    </td>
                                    <td>
                                        {{dataModel.JZAvgYield}}
                                    </td>
                                    <td>
                                        {{dataModel.JZOutput}}
                                    </td>
                                    <td>
                                        {{dataModel.JZMuOutput}}
                                    </td>
                                    <td>
                                        {{dataModel.JZDensity}}
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </TabPane>
                    <TabPane label="间作、套种" >
                        <table class="statisTable" :style="tableStyle" >
                            <thead>
                                <tr> 
                                    <th colspan="7">间作、套种</th>
                                </tr>
                                <tr>
                                    <th rowspan="2">面积（万亩）</th>
                                    <th rowspan="2">马铃薯产量（万吨）</th>
                                    <th rowspan="2">马铃薯平均亩产（公斤/亩）</th>
                                    <th rowspan="2">复合产量（万吨）</th>
                                    <th rowspan="2">复合产值（万元）</th>
                                    <th rowspan="2">复合亩产（公斤/亩）</th>
                                    <th rowspan="2">复合亩产值（元）</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for="(dataModel,index) in dataList" :key="index">
                                    
                                    <td>
                                        {{dataModel.JTArea}}
                                    </td>  
                                    <td>
                                        {{dataModel.JTYield}}
                                    </td> 
                                    <td>
                                        {{dataModel.JTAvgYield}}
                                    </td> 
                                    <td>
                                        {{dataModel.JTMixYield}}
                                    </td>
                                    <td>
                                        {{dataModel.JTMixOutput}}
                                    </td>
                                    <td>
                                        {{dataModel.JTMixMuYield}}
                                    </td>
                                    <td>
                                        {{dataModel.JTMixMuOutput}}
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </TabPane>
                    <TabPane label="机械化生产" >
                        <table class="statisTable" :style="tableStyle" >
                            <thead>
                                <tr> 
                                    <th colspan="5">机械化生产</th>
                                </tr>
                                <tr>
                                    <th rowspan="2">机械播种面积（万亩）</th>
                                    <th colspan="3">机械田间管理面积（万亩）</th>
                                    <th rowspan="2">机械收获面积（万亩）</th>
                                </tr>
                                <tr>
                                    <th>其中：中耕培土</th>
                                    <th>施肥</th>
                                    <th>施药</th>            
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for="(dataModel,index) in dataList" :key="index">
                                    <td>
                                        {{dataModel.MechPlantArea}}
                                    </td>
                                    <td>
                                        {{dataModel.MechCultivationArea}}
                                    </td>
                                    <td>
                                        {{dataModel.MechFertilizerArea}}
                                    </td>
                                    <td>
                                        {{dataModel.MechPesticideArea}}
                                    </td> 
                                    <td>
                                        {{dataModel.MechHarvestArea}}
                                    </td> 
                                </tr>
                            </tbody>
                        </table>
                    </TabPane>
                    <TabPane label="亩均收益" >
                        <table class="statisTable" :style="tableStyle" >
                            <thead>
                                <tr>  
                                    <th colspan="11">亩均收益</th>
                                </tr>
                                <tr>
                                    <th colspan="7">投入（元）</th>
                                    <th colspan="3">产出</th>
                                    <th rowspan="2">收益</th>
                                </tr>
                                <tr>
                                    <th>种薯</th>
                                    <th>肥料</th>
                                    <th>农药</th>
                                    <th>地膜</th>
                                    <th>全生育期用工费</th>
                                    <th>其他</th>
                                    <th>投入合计</th>   
                                    <th>平均亩产（公斤/亩）</th>
                                    <th>平均单价（元/公斤）</th>
                                    <th>产出合计（元）</th>                      
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for="(dataModel,index) in dataList" :key="index">
                                    <td>
                                        {{dataModel.SeedCost}}
                                    </td> 
                                    <td>
                                        {{dataModel.FertilizerCost}}
                                    </td> 
                                    <td>
                                        {{dataModel.PesticideCost}}
                                    </td>
                                    <td>
                                        {{dataModel.MulchCost}}
                                    </td>
                                    <td>
                                        {{dataModel.LaborCost}}
                                    </td>
                                    <td>
                                        {{dataModel.OtherCost}}
                                    </td>
                                    <td>
                                        {{dataModel.TotalCost}}
                                    </td>
                                    <td>
                                        {{dataModel.OAvgMuYield}}
                                    </td> 
                                    <td>
                                        {{dataModel.OAvgPrice}}
                                    </td>
                                    <td>
                                        {{dataModel.OTotalOutput}}
                                    </td>
                                    <td>
                                        {{dataModel.Income}}
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </TabPane>
                </Tabs>
                </div> -->
            </div>
         </Row>
         <Row v-show="pieShow">
            <!--饼图-->
            <div  id="divPie" style="width:1200px;height:670px;">饼图</div>
        </Row>
        <Row  v-show="mapShow" class="divStatis">
            <!--地图展示-->
            <Tabs type="card">
                <TabPane label="总体概况">
                    <div id="divMapOne" style="border:1px solid #D7DDE4; "></div>
                </TabPane>
                <TabPane label="净作">
                    <div id="divMapTwo" style="border:1px solid #D7DDE4;"></div>
                </TabPane>
                <TabPane label="间作、套种">
                    <div id="divMapThree" style="border:1px solid #D7DDE4; "></div>
                </TabPane>
                <TabPane label="机械化生产">
                    <div id="divMapFour" style="border:1px solid #D7DDE4; "></div>
                </TabPane>
                <TabPane label="亩均收益">
                    <div id="divMapFive" style="border:1px solid #D7DDE4; "></div>
                </TabPane>
            </Tabs>
        </Row>
    </div>
</template>
<script>
export default {
    data() {
        return {
            isCounty:false,
            cdataList:[],
            showType:false,
            detailList:[],//详情页列表对象
            currentButton:'listShow',
            listShow:true,//列表显示控制器
            pieShow:false,//饼图显示控制器
            mapShow:false,//地图显示控制器 
            userInfo: '',
            AreaList: [],//所属行政区划数组,
            TableCodeList: this.GetGroupDict("ReportTableName"),//表名称
            CreateYearList: this.GetGroupDict("ReportYear"),//周期
            QuarterList: this.GetGroupDict("QuarterCycleValue"), 
            tableStyle:{
                //height:window.innerHeight - 193+'px',
                marginTop:'30px',
                width:'99%'
                },
            DataModel: {//编辑模型
                Id: 0,
                ReportId: '',
                
            },
            //查询模型：根据需求删除不不要查询条件
            searchModel: {
                ReportCode: 'PotSeasonProduct',
                FillInYear: new Date().getFullYear()+"",
                TimesCycle: '1',
                SeasonDict:'',//季别
                AreaCode: this.GetlocaStorage("potUserinfo").AreaCode,
                Status:'',
                PageNumber: 1, PageSize: 20
            },
            dataList:[],
            columnList:[
                {title:'地区',key:'AreaName',align:'center',fixed:'left',width:180},
                {title:'总面积（万亩）',key:'TotalArea',align:'right',width:120,sortable: true},
                {title:'总产量（万吨）',key:'TotalYield',align:'right',width:120,sortable: true},
                {title:'平均亩产（公斤/亩）',key:'AvgMuYield',align:'right',width:120,sortable: true},
                {title:'亩产值（元）',key:'MuOutput',align:'right',width:120,sortable: true},
                {title:'总产值（万元）',key:'TotalOutput',align:'right',width:120,sortable: true},
                {title:'脱毒种薯覆盖面积（万亩）',key:'tdSeedArea',align:'right',width:120,sortable: true},
                {title:'脱毒种薯覆盖率（%）',key:'SeedCoverage',align:'right',width:120,sortable: true},
                {title:'地膜覆盖面积（万亩）',key:'MulchArea',align:'right',width:120,sortable: true},
                {title:'膜下滴灌面积（万亩）',key:'DripArea',align:'right',width:120,sortable: true},
                {title:'配方施肥面积（万亩）',key:'FertilizerArea',align:'right',width:120,sortable: true},
                {title:'免耕栽培面积（万亩）',key:'NoCultivationArea',align:'right',width:120,sortable: true},
                {title:'净作',align:'center',children:[
                    {title:'面积(万亩）',key:'JZArea',align:'right',width:120,sortable: true},
                    {title:'产量（万吨）',key:'JZYield',align:'right',width:120,sortable: true},
                    {title:'平均亩产（公斤/亩）',key:'JZAvgMuYield',align:'right',width:120,sortable: true},
                    {title:'产值（万元）',key:'JZOutput',align:'right',width:120,sortable: true},
                    {title:'亩产值（元）',key:'JZMuOutput',align:'right',width:120,sortable: true},
                    {title:'种植密度（株/亩）',key:'JZDensity',align:'right',width:120,sortable: true},
                ]},
                {title:'间作、套种',align:'center',children:[
                    {title:'面积(万亩）',key:'JTArea',align:'right',width:120,sortable: true},
                    {title:'马铃薯产量（万吨）',key:'JTYield',align:'right',width:120,sortable: true},
                    {title:'马铃薯平均亩产（公斤/亩）',key:'JTAvgMuYield',align:'right',width:120,sortable: true},
                    {title:'复合产量（万吨）',key:'JTMixYield',align:'right',width:120,sortable: true},
                    {title:'复合产值（万元）',key:'JTMixOutput',align:'right',width:120,sortable: true},
                    {title:'复合亩产（公斤/亩）',key:'JTMixMuYield',align:'right',width:120,sortable: true},
                    {title:'复合亩产值（元）',key:'JTMixMuOutput',align:'right',width:120,sortable: true},
                ]},
                {title:'机械化生产',align:'center',children:[
                    {title:'机械播种面积（万亩）',key:'MechPlantArea',align:'right',width:120,sortable: true},
                    {title:'机械田间管理面积（万亩）',align:'center',children:[
                        {title:'其中：中耕培土',key:'MechCultivationArea',align:'right',width:120,sortable: true},
                        {title:'施肥',key:'MechFertilizerArea',align:'right',width:120,sortable: true},
                        {title:'施药',key:'MechPesticideArea',align:'right',width:120,sortable: true}
                    ]},
                    {title:'机械收获面积（万亩）',key:'MechHarvestArea',align:'right',width:120,sortable: true},
                ]},
                {title:'亩均收益',align:'center',children:[
                    {title:'投入（元）',align:'center',children:[
                        {title:'种薯',key:'SeedCost',align:'right',width:120,sortable: true},
                        {title:'肥料',key:'FertilizerCost',align:'right',width:120,sortable: true},
                        {title:'农药',key:'PesticideCost',align:'right',width:120,sortable: true},
                        {title:'地膜',key:'MulchCost',align:'right',width:120,sortable: true},
                        {title:'全生育期用工费',key:'LaborCost',align:'right',width:120,sortable: true},
                        {title:'其他',key:'OtherCost',align:'right',width:120,sortable: true},
                        {title:'投入合计',key:'TotalCost',align:'right',width:120,sortable: true},
                    ]},
                    {title:'产出',align:'center',children:[
                        {title:'平均亩产（公斤/亩）',key:'OAvgMuYield',align:'right',width:120,sortable: true},
                        {title:'平均单价（元/公斤）',key:'OAvgPrice',align:'right',width:120,sortable: true},
                        {title:'产出合计（元）',key:'OTotalOutput',align:'right',width:120,sortable: true},
                    ]},
                    {title:'收益（元）',key:'Income',align:'right',width:120,sortable: true},
                ]},
            ],
            CurrentAreaName:'',
            mapType:'',
            echartsItem0:['总面积（万亩）','总产量（万吨）','平均亩产（公斤/亩）','亩产值（元）','总产值（万元）','脱毒种薯覆盖面积（万亩）','脱毒种薯覆盖率（%）',
                '地膜覆盖面积（万亩）','膜下滴灌面积（万亩）','配方施肥面积（万亩）','免耕栽培面积（万亩）'],
            echartsItem1:['面积(万亩）','产量（万吨）','平均亩产（公斤/亩）','产值（万元）','亩产值（元）','种植密度（株/亩）'],
            echartsItem2:['面积（万亩）','马铃薯产量（万吨）','马铃薯平均亩产（公斤/亩）','复合产量（万吨）','复合产值（万元）',
                '复合亩产（公斤/亩）','复合亩产值（元）'],
            echartsItem3:['机械播种面积（万亩）','中耕培土','施肥','施药','机械收获面积（万亩）'],
            echartsItem4:['种薯（元）','肥料（元）','农药（元）','地膜（元）','全生育期用工费（元）','其他（元）','投入合计（元）',
                '平均单价（元/公斤）','产出合计（元）','收益（元）'],
            GeoData:'',
            //地图数据
            //总体概况
            MapTotalAreaData:[],
            MapTotalYieldData:[],
            MapAvgMuYieldData:[],
            MapMuOutputData:[],
            MapTotalOutputData:[],
            MaptdSeedAreaData:[],
            MapSeedCoverageData:[],
            MapMulchAreaData:[],
            MapDripAreaData:[],
            MapFertilizerAreaData:[],
            MapNoCultivationAreaData:[],
            //净作
            MapJZAreaData:[],
            MapJZYieldData:[],
            MapJZAvgMuYieldData:[],
            MapJZOutputData:[],
            MapJZMuOutputData:[],
            MapJZDensityData:[],
            //间作、套种
            MapJTAreaData:[],
            MapJTYieldData:[],
            MapJTAvgMuYieldData:[],
            MapJTMixYieldData:[],
            MapJTMixOutputData:[],
            MapJTMixMuYieldData:[],
            MapJTMixMuOutputData:[],
            //机械化生产
            MapMechPlantAreaData:[],
            MapMechCultivationAreaData:[],
            MapMechFertilizerAreaData:[],
            MapMechPesticideAreaData:[],
            MapMechHarvestAreaData:[],
            //亩均收益
            MapSeedCostData:[],
            MapFertilizerCostData:[],
            MapPesticideCostData:[],
            MapMulchCostData:[],
            MapLaborCostData:[],
            MapOtherCostData:[],
            MapTotalCostData:[],
            MapOAvgPriceData:[],
            MapOTotalOutputData:[],
            MapIncomeData:[],

            mapList0:[],
            mapList1:[],
            mapList2:[],
            mapList3:[],
            mapList4:[],
            clientHeight: window.innerHeight - 185,//表格默认高度
        }
    },
    mounted() {
        //table高度计算方法
        const that = this;
        window.onresize = () => {
            return (() => {
                that.clientHeight = window.innerHeight - 185;
            })()
        };
    },
    methods: {
        SearchAreaList() {
            var areaCode = this.userInfo.AreaCode;
            var areaList=[];
            var templist = [];
            var areaEntity = new Object();
            areaEntity.value=areaCode;
            areaEntity.children=[];
            if (areaCode != '530000000000' && areaCode != null) {
                var item = this.GetlocaStorage("areatreelist")[0];
                areaEntity.label="全州（市）";
                for (var i = 0; i < item.children.length; i++) {
                    if (item.children[i].value == areaCode) {
                        areaList.push(item.children[i]);
                    }
                }
            } else {
                areaEntity.label="全省";
                areaList = this.GetlocaStorage("areatreelist");
            }
            templist.push(areaEntity);
             this.AreaList=templist.concat(areaList[0].children);
        },
       changeButton(n){
            if(n=="listShow")
            {
                this.listShow=true;//显示列表
                this.pieShow=false;
                this.mapShow=false;
            }
            else if(n=="pieShow")
            {
                this.listShow=false;
                this.pieShow=true;//显示饼图
                this.mapShow=false;
               // this.showPie();
            }
             else if(n=="mapShow")
            {
                this.listShow=false;
                this.pieShow=false;//显示地图
                this.mapShow=true;
                //  this.getStatsData();   //获取地区统计数据  
                //this.showMap();
            }
            else{
                 this.listShow=true;//默认显示列表
                 this.pieShow=false;
                 this.mapShow=false;
            }
        },
        Download(){
            if(this.isCounty){
                window.open(this.$http.defaults.baseURL + "PotSeasonProduct/GetExcelData?FillInYear=" + this.searchModel.FillInYear + "&&AreaCode=" + this.searchModel.AreaCode+"&&TimesCycle=" + this.searchModel.TimesCycle);
            }
            else{
                window.open(this.$http.defaults.baseURL + "PotSeasonProduct/GetStatisExcel?FillInYear="+ this.searchModel.FillInYear 
                + "&&AreaCode=" + this.searchModel.AreaCode+"&&TimesCycle=" + this.searchModel.TimesCycle + "&&SeasonDict="+ this.searchModel.SeasonDict 
                );
            }
          
        },
        GetData(){
          if(this.isCounty){
                this.getCountyListData();
            }else{
                this.getListData();
            }
        },
        rowStyle(index,length){  
            let striprow ={ backgroundColor: '#ebf7ff'};    
            if(index==(length-1)){       
                return {
                    backgroundColor: '#f9c912'
                }
            }
            else if(index%2 !=0){
                return striprow;
            }
             else{
               return 
           }
        },
        rowclass(item,index){
          let striprow ={
            backgroundColor: '#ebf7ff'
          }
          let cityrow = {
             backgroundColor: '#ff6600'
          }
          let provinrow = {
            backgroundColor: '#183'
          }
            if(index %2 ==0){
              if(item.tag==1){
                return cityrow
              }
              else if(item.tag==2){
                return provinrow
              }              
            }
            else{
              if(item.tag==1){
                return cityrow
              }
              else if(item.tag==2){
                return provinrow
              }
              else{
                return striprow
              }
            }
        },
        getListData(){
            var self = this;
            //判断当前用户是否为省级账号
            if(self.userInfo.AreaCode=="530000000000")
            {
                // self.isProvince=true;
                self.mapType=self.searchModel.AreaCode;
            }
            else{
                self.mapType=self.userInfo.AreaCode;
            }
            //地图数据
            //总体概况
            self.MapTotalAreaData=[],
            self.MapTotalYieldData=[],
            self.MapAvgMuYieldData=[],
            self.MapMuOutputData=[],
            self.MapTotalOutputData=[],
            self.MaptdSeedAreaData=[],
            self.MapSeedCoverageData=[],
            self.MapMulchAreaData=[],
            self.MapDripAreaData=[],
            self.MapFertilizerAreaData=[],
            self.MapNoCultivationAreaData=[],
            //净作
            self.MapJZAreaData=[],
            self.MapJZYieldData=[],
            self.MapJZAvgMuYieldData=[],
            self.MapJZOutputData=[],
            self.MapJZMuOutputData=[],
            self.MapJZDensityData=[],
            //间作、套种
            self.MapJTAreaData=[],
            self.MapJTYieldData=[],
            self.MapJTAvgMuYieldData=[],
            self.MapJTMixYieldData=[],
            self.MapJTMixOutputData=[],
            self.MapJTMixMuYieldData=[],
            self.MapJTMixMuOutputData=[],
            //机械化生产
            self.MapMechPlantAreaData=[],
            self.MapMechCultivationAreaData=[],
            self.MapMechFertilizerAreaData=[],
            self.MapMechPesticideAreaData=[],
            self.MapMechHarvestAreaData=[],
            //亩均收益
            self.MapSeedCostData=[],
            self.MapFertilizerCostData=[],
            self.MapPesticideCostData=[],
            self.MapMulchCostData=[],
            self.MapLaborCostData=[],
            self.MapOtherCostData=[],
            self.MapTotalCostData=[],
            self.MapOAvgPriceData=[],
            self.MapOTotalOutputData=[],
            self.MapIncomeData=[],

            self.mapList0=[],
            self.mapList1=[],
            self.mapList2=[],
            self.mapList3=[],
            self.mapList4=[],
            self.GeoData=self.GetGeoData(self.mapType); 
            this.$http.get('PotSeasonProduct/GetStatisListData',{params: this.searchModel}).then(function(res){
                if(res.data.status==1){
                    self.dataList = res.data.model;
                    self.CurrentAreaName=res.data.model[res.data.model.length-1].AreaName=="合计"?'云南省':res.data.model[res.data.model.length-1].AreaName;
                    for(var i=0;i<res.data.model.length-1;i++)
                    {
                    //地图数据
                    //总体概况
                    self.MapTotalAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].TotalArea});
                    self.MapTotalYieldData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].TotalYield});
                    self.MapAvgMuYieldData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].AvgMuYield});
                    self.MapMuOutputData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].MuOutput});
                    self.MapTotalOutputData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].TotalOutput});
                    self.MaptdSeedAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].tdSeedArea});
                    self.MapSeedCoverageData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].SeedCoverage});
                    self.MapMulchAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].MulchArea});
                    self.MapDripAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].DripArea});
                    self.MapFertilizerAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].FertilizerArea});
                    self.MapNoCultivationAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].NoCultivationArea});
                    //净作
                    self.MapJZAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JZArea});
                    self.MapJZYieldData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JZYield});
                    self.MapJZAvgMuYieldData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JZAvgMuYield});
                    self.MapJZOutputData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JZOutput});
                    self.MapJZMuOutputData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JZMuOutput});
                    self.MapJZDensityData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JZDensity});
                    //间作、套种
                    self.MapJTAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JTArea});
                    self.MapJTYieldData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JTYield});
                    self.MapJTAvgMuYieldData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JTAvgMuYield});
                    self.MapJTMixYieldData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JTMixYield});
                    self.MapJTMixOutputData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JTMixOutput});
                    self.MapJTMixMuYieldData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JTMixMuYield});
                    self.MapJTMixMuOutputData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JTMixMuOutput});
                    //机械化生产
                    self.MapMechPlantAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].MechPlantArea});
                    self.MapMechCultivationAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].MechCultivationArea});
                    self.MapMechFertilizerAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].MechFertilizerArea});
                    self.MapMechPesticideAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].MechPesticideArea});
                    self.MapMechHarvestAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].MechHarvestArea});
                     //亩均收益
                    self.MapSeedCostData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].SeedCost});
                    self.MapFertilizerCostData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].FertilizerCost});
                    self.MapPesticideCostData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PesticideCost});
                    self.MapMulchCostData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].MulchCost});
                    self.MapLaborCostData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].LaborCost});
                    self.MapOtherCostData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].OtherCost});
                    self.MapTotalCostData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].TotalCost});
                    self.MapOAvgPriceData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].OAvgPrice});
                    self.MapOTotalOutputData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].OTotalOutput});
                    self.MapIncomeData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].Income});
                    
                    }
                    
                    //地图数据
                    self.mapList0.push(self.MapTotalAreaData,self.MapTotalYieldData,self.MapAvgMuYieldData,
                        self.MapMuOutputData,self.MapTotalOutputData,self.MaptdSeedAreaData,self.MapSeedCoverageData,
                        self.MapMulchAreaData,self.MapDripAreaData,self.MapFertilizerAreaData,self.MapNoCultivationAreaData);
                    self.mapList1.push(self.MapJZAreaData,self.MapJZYieldData,self.MapJZAvgMuYieldData,
                        self.MapJZOutputData,self.MapJZMuOutputData,self.MapJZDensityData);
                    self.mapList2.push(self.MapJTAreaData,self.MapJTYieldData,self.MapJTAvgMuYieldData,self.MapJTMixYieldData,
                        self.MapJTMixOutputData,self.MapJTMixMuYieldData,self.MapJTMixMuOutputData);
                    self.mapList3.push(self.MapMechPlantAreaData,self.MapMechCultivationAreaData,self.MapMechFertilizerAreaData,
                        self.MapMechPesticideAreaData,self.MapMechHarvestAreaData);
                    self.mapList4.push(self.MapSeedCostData,self.MapFertilizerCostData,self.MapPesticideCostData,
                        self.MapMulchCostData,self.MapLaborCostData,self.MapOtherCostData,self.MapTotalCostData,
                        self.MapOAvgPriceData,self.MapOTotalOutputData,self.MapIncomeData);
                    self.showMap();
                }else{
                    self.$Modal.error({title:'提示信息',content:res.data.message});
                }
            })
        },
        showMap(){
            var self=this;
            var containerTable=document.getElementsByClassName('ivu-col ivu-col-span-4');
            //******************显示地图
            
            var containerMapOne=document.getElementById('divMapOne');
            var containerMapTwo=document.getElementById('divMapTwo');
            var containerMapThree=document.getElementById('divMapThree');
            var containerMapFour=document.getElementById('divMapFour');
            var containerMapFive=document.getElementById('divMapFive');
            // //用于使chart自适应高度和宽度,通过窗体高宽计算容器高宽
            var resizeContainerMap = function () {
                //containerTable[0].clientWidth 左侧菜单栏的宽度
                containerMapOne.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerMapOne.style.height = (window.innerHeight-280)+'px';
                containerMapTwo.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerMapTwo.style.height = (window.innerHeight-280)+'px';
                containerMapThree.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerMapThree.style.height = (window.innerHeight-280)+'px';
                containerMapFour.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerMapFour.style.height = (window.innerHeight-280)+'px';
                containerMapFive.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
                containerMapFive.style.height = (window.innerHeight-280)+'px';
            };
            //设置容器高宽
            resizeContainerMap();

            var myMapOne = myEcharts.init(containerMapOne, 'shine');
            var myMapTwo = myEcharts.init(containerMapTwo, 'shine');
            var myMapThree = myEcharts.init(containerMapThree, 'shine');
            var myMapFour = myEcharts.init(containerMapFour, 'shine');
            var myMapFive = myEcharts.init(containerMapFive, 'shine');
            var MapNameOne=this.searchModel.FillInYear+'年(三)'+self.CurrentAreaName+'马铃薯种薯生产情况统计表';
            var MapNameTwo=this.searchModel.FillInYear+'年(三)'+self.CurrentAreaName+'马铃薯种薯生产情况统计表';
            var MapNameThree=this.searchModel.FillInYear+'年(三)'+self.CurrentAreaName+'马铃薯种薯生产情况统计表';
            var MapNameFour=this.searchModel.FillInYear+'年(三)'+self.CurrentAreaName+'马铃薯种薯生产情况统计表';
            var MapNameFive=this.searchModel.FillInYear+'年(三)'+self.CurrentAreaName+'马铃薯种薯生产情况统计表';
            var optionMapOne = self.GetMapOption(MapNameOne,self.GeoData,self.mapType,self.echartsItem0,self.mapList0);
            var optionMapTwo = self.GetMapOption(MapNameTwo,self.GeoData,self.mapType,self.echartsItem1,self.mapList1);
            var optionMapThree = self.GetMapOption(MapNameThree,self.GeoData,self.mapType,self.echartsItem2,self.mapList2);
            var optionMapFour = self.GetMapOption(MapNameFour,self.GeoData,self.mapType,self.echartsItem3,self.mapList3);
            var optionMapFive = self.GetMapOption(MapNameFive,self.GeoData,self.mapType,self.echartsItem4,self.mapList4);
            myMapOne.setOption(optionMapOne);
            myMapTwo.setOption(optionMapTwo);
            myMapThree.setOption(optionMapThree);
            myMapFour.setOption(optionMapFour);
            myMapFive.setOption(optionMapFive);
            //用于使chart自适应高度和宽度
            window.onresize = function () {
                //重置容器高宽
                resizeContainerMap();
                myMapOne.resize();
                myMapTwo.resize();
                myMapThree.resize();
                myMapFour.resize();
                myMapFive.resize();
            };
        },
        getCountyListData(){
            var self = this;
            this.$http.get("PotSeasonProduct", { params: { AreaCode: this.searchModel.AreaCode,FillInYear:this.searchModel.FillInYear,TimesCycle:this.searchModel.TimesCycle } }).then(
                function (res) {
                    if (res.data.status == 1) {
                        self.cdataList = res.data.model; 
                    }
                    else{
                        self.$Modal.error({title:'提示信息',content:res.data.message});
                    }   
                    
            });
        },
        currentYear() {
           let year = new Date().getFullYear();
           let month = new Date().getMonth();
            if (month > 1) {
                this.searchModel.FillInYear = year.toString();
            } else {
               this.searchModel.FillInYear = (year - 1).toString();
              }
        },
        // SearchCascaderChange(value, selectedData) {
        //     const index = value.length - 1;
        //     this.searchModel.AreaCode = value[index];
        //     if(this.searchModel.AreaCode.substr(4,2) !="00"){
        //         this.isCounty = true;
        //     }
        //     else{
        //         this.isCounty = false;
        //     }
        //     this.GetData();
        // },
        SearchCascaderChange() {
            if(this.searchModel.AreaCode.substr(4,2) !="00"){
                this.isCounty = true;
            }
            else{
                this.isCounty = false;
            }
            this.GetData();
        },
    },
    //创建Vue页面方法
    created: function () {
       // this.currentYear();
       //this.SearchAreaList();
       this.userInfo = this.GetlocaStorage("potUserinfo");
       this.AreaList = this.getChildAreaList(this.userInfo.AreaCode)
       this.getListData();
    },
    watch: {
        //需要监听的在此处新增监听对象
    }
}
</script>
